from django.shortcuts import render
from forms import UsersForm
from models import Users
from django.http import HttpResponseRedirect
from django.template.loader import get_template
from django.shortcuts import render_to_response
from django.http import HttpResponse,Http404
from django.template import Context
def contact(request):
     if request.method == 'POST':
         form = UsersForm(request.POST)
         if form.is_valid():
              username = form.cleaned_data['uname']
              usernick = form.cleaned_data['upet']
              pawd1 = form.cleaned_data['upawd']
              email = form.cleaned_data['email']
              weburl = form.cleaned_data['url']
              Users(uname=username,upet=usernick,upawd=pawd1,email=email,url=weburl).save()
              return HttpResponseRedirect('/index/')
     else:
         return render_to_response('contact.html', {'form': form,})

# Create your views here.
